﻿//
// © Algobox Ltd - Benn Eichhorn
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Algobox.Objects.Finance.Assets.Stock;

namespace Algobox.Feeds.Finance.MarketData
{
    public class MarketFeedRequest
    {
        #region Constructors

        public MarketFeedRequest(IStock stock)
        {
            _count = 1;
            Stock = stock;
        }

        #endregion

        //////////

        #region Member Variables
        

        private long _count;


        #endregion

        //////////

        #region Properties


        /// <summary>
        /// Number of current subscribers to this request
        /// </summary>
        public long Count { get { return System.Threading.Interlocked.Read(ref _count); } }

        /// <summary>
        /// The stock listing or security that maps to this request
        /// </summary>
        public IStock Stock { get; private set; }


        #endregion

        //////////

        #region Functions


        public long Increment()
        {
            return System.Threading.Interlocked.Increment(ref _count);
        }

        public long Decrement()
        {
            return System.Threading.Interlocked.Decrement(ref _count);
        }


        #endregion

        //////////

        #region Enums



        #endregion
    }
}
